@import './theme';

.widget {
    background-color: #FFF;
    margin-bottom: 10px;

    &.widget-borderless {
        .widget-header,
        .widget-content,
        .widget-footer {
            border: 0;
        }
        .widget-header + .widget-content,
        .widget-header + .widget-footer,
        .widget-content + .widget-footer {
            border-top: 1px solid #ccc;
        }
    }

    &.widget-fullscreen {
        position: fixed;
        top: 50px; // navbar
        left: 60px; // sidebar
        right: 0;
        bottom: 0;
        margin: 0;
        z-index: 1000;

        .widget-sortable {
            display: none;
        }
    }
    &.widget-fullscreen {
        .widget-content {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
        }
        .widget-header + .widget-content {
            position: absolute;
            top: 34px; // .widget-header height
            bottom: 0;
            left: 0;
            right: 0;
        }
    }

    .widget-header {
        clearfix();
        background-color: #f6f7f8;
        border: 1px solid #ccc;
        position: relative;
    }
    .widget-header-fixed {
        cursor: default;
    }

    .widget-sortable {
        display: inline-block;
        cursor: move;

        > a {
            cursor: move;
        }
    }

    .widget-title {
        font-size: 14px;
        font-weight: 400;
        line-height: 32px;
        display: inline-block;
        vertical-align: middle;
        margin-top: 0;
        margin-bottom: 0;
        padding: 0 10px;

        // Truncate string with ellipsis
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        width: 100%;
        max-width: 100%;
    }

    .widget-content,
    .widget-footer {
        border: 1px solid #CCC;
        border-top: none;
    }

    .widget-button {
        text-decoration: none;
        font-size: 14px;
        text-align: center;
        display: inline-block;
        line-height: 32px;
        padding: 0;
        margin: 0;
    }

    .widget-controls {
        position: absolute;
        top: 0;
        right: 0;
        cursor: auto;
        width: auto;

        .widget-button {
            min-width: 30px;
            height: 32px;
            float: left;
            position: relative;
            font-size: 14px;
            font-family: Arial, Helvetica, sans-serif;
            border-left: 1px solid rgba(0, 0, 0, .09);
            margin: 0;
            text-align: center;

            &.disabled {
                color: #bbb;
                cursor: not-allowed;
            }

            &.disabled:hover {
                background-color: inherit;
            }
            &:hover {
                background-color: rgba(0, 0, 0, .05);
            }

            &.inverted {
                color: #fff;
                background-color: #404040;
            }
            &.inverted:hover {
                background-color: #222;
            }
            &.inverted.disabled {
                opacity: .4;
            }

            &:first-child {
                padding-left: 0;
            }
        }
    }
}
